from django.conf.urls.defaults import *
import os

from django.contrib.auth.views import login, logout

urlpatterns = patterns('',
    # ---- General ----
    (r'^home/$', 'cuestionarios.main.views.home'),
    (r'^error/$', 'cuestionarios.main.views.error'),
    (r'^error_login/$', 'cuestionarios.main.views.user_not_found'),

    # --- Autentificacion ---
    (r'^entrar/$', login),
    (r'^salir/$', logout, {"next_page":"/home/"}),


    # WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB 

    # Registro
    (r'^register/$', 'cuestionarios.main.views.register'),
    (r'^register_ok/$', 'cuestionarios.main.views.register_ok'),
    # CRUD
    (r'^my_forms/$', 'cuestionarios.manejador.views.my_forms'),
    (r'^my_forms/new/$', 'cuestionarios.manejador.views.new_forms'),
    (r'^edit_form/(\d+)/$', 'cuestionarios.manejador.views.edit_form'),
    (r'^edit_form/(\d+)/add_question/$', 'cuestionarios.manejador.views.add_question'),
    (r'^edit_question/(\d+)/(\d+)/$', 'cuestionarios.manejador.views.edit_question'),
    (r'^update_answer/(\d+)/(\d+)/(\d+)/$', 'cuestionarios.manejador.views.update_answer'),
    (r'^delete_answer/(\d+)/(\d+)/(\d+)/$', 'cuestionarios.manejador.views.delete_answer'),
    (r'^update_question/(\d+)/(\d+)/$', 'cuestionarios.manejador.views.update_question'),
    (r'^delete_question/(\d+)/(\d+)/$', 'cuestionarios.manejador.views.delete_question'),
    (r'^update_my_form/(\d+)/$', 'cuestionarios.manejador.views.update_my_form'),
    (r'^delete_my_form/(\d+)/$', 'cuestionarios.manejador.views.delete_my_form'),
    (r'^change_valid_answer/(\d+)/(\d+)/(\d+)/$', 'cuestionarios.manejador.views.change_valid_answer'),

    # WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB WEB 

    
    # WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP

    # Contestar cuestionarios
    (r'^view_forms/$', 'cuestionarios.manejador.views.view_forms'),
    (r'^contestar/(\d+)/$', 'cuestionarios.manejador.views.contestar'),
    (r'^peticion_ajax/$', 'cuestionarios.manejador.views.ajax'),
    (r'^siguiente_ajax/(\d+)/$', 'cuestionarios.manejador.views.ajax_next'),
    (r'^form_stats/(\d+)/$', 'cuestionarios.manejador.views.form_stats'),
    (r'^view_mystats/$', 'cuestionarios.manejador.views.mystats'),

    # WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP WAP


    # Otros
    (r'^admin/', include('django.contrib.admin.urls')),
    (r'^(?P<path>.*)$','django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'static').replace('\\','/')}),   
)
